Base class for binding runtimes. More...
#include <kanzi/core.ui/binding/abstract_binding_runtime.hpp>
Public Types | |
enum | AttachmentState { Detached , Detaching , Attaching , Attached , Removed } |
Attachment state for keeping track current status. More... | |
Public Member Functions | |
void | attach () |
Attach the binding. | |
void | detach () |
Detaches the binding. | |
void | detachIfAttachedOrAttaching () |
Detaches the binding if it is attaching or attached. | |
AbstractBindingSharedPtr | getBinding () const |
Returns the binding associated with this binding runtime. | |
BindingLookupContext & | getLookupContext () const |
Gets the lookup context. | |
shared_ptr< void > | getOwner () const |
Gets the owner. | |
BindingSourceRuntime * | getSourceRuntime () const |
Gets the source runtime. | |
BindingTargetRuntime * | getTargetRuntime () const |
Gets the target runtime. | |
bool | isAttached () const |
Indicates whether this binding runtime has been attached. | |
bool | isAttaching () const |
Indicates whether this binding runtime is being attached. | |
bool | isConnected () |
Indicates whether this binding runtime is connected. | |
bool | isDetached () const |
Indicates whether this binding runtime is detached. | |
bool | isDetaching () const |
Indicates whether this binding runtime is being detached. | |
bool | isRemoved () const |
Gets whether the binding runtime has been removed from the binding host. | |
void | notifySourceChanged () |
Called when binding source has changed. | |
void | notifyTargetChanged () |
Called when binding target has changed. | |
void | onRemoved () |
Called when binding is being removed from where it has been installed. | |
void | removeFromHost () |
Removes the binding runtime from the binding host. | |
void | setHost (BindingHostConceptSharedPtr hostObject) |
Sets the binding host object in which the binding runtime is hosted. | |
void | setOwner (shared_ptr< void > owner) |
Set the owner. | |
bool | update () |
Execute the binding. | |
virtual | ~AbstractBindingRuntime () |
Destructor. | |
Protected Member Functions | |
AbstractBindingRuntime (AbstractBindingSharedPtr binding, BindingLookupContextPtr lookupContext, BindingSourceRuntimePtr sourceRuntime, BindingTargetRuntimePtr targetRuntime) | |
Constructor. | |
virtual void | attachOverride ()=0 |
Binding-dependent attach. | |
virtual void | detachOverride ()=0 |
Binding-dependent detach. | |
virtual bool | isConnectedOverride () |
Binding-dependent attached indication. | |
virtual void | notifySourceChangedOverride () |
Binding-dependent source change. | |
virtual void | notifyTargetChangedOverride () |
Binding-dependent target change. | |
bool | readFromSource (Variant &value) |
Read from source and execute forward validators. | |
bool | readFromTarget (Variant &value) |
Reads from target and executes reverse validators. | |
virtual bool | updateOverride ()=0 |
Binding-dependent update. | |
bool | writeToSource (const Variant &value) const |
Writes to source. | |
bool | writeToTarget (const Variant &value) |
Write to target. | |
Protected Attributes | |
AttachmentState | m_attachmentState |
Current binding runtime state. | |
AbstractBindingSharedPtr | m_binding |
Associated binding. | |
BindingHostConceptWeakPtr | m_bindingHost |
The binding host object in which the binding runtime is hosted. | |
BindingLookupContextPtr | m_lookupContext |
weak_ptr< void > | m_owner |
Owner for tagging the runtime. | |
BindingSourceRuntimePtr | m_sourceRuntime |
Runtime for source. | |
BindingTargetRuntimePtr | m_targetRuntime |
Runtime for target. | |
Base class for binding runtimes.
Bindings create abstract binding runtimes to serve as the runtime data of the bindings. Binding runtimes refer to their source bindings, but do not alter them.
Distinct binding implementations create objects of classes inheriting the base AbstractBindingRuntime.
When you remove a binding runtime from a binding host, Kanzi detaches the binding and makes the binding runtime unusable.
|
virtual |
Destructor.
|
explicitprotected |
Constructor.
Abstract binding runtime takes ownership of both source and target runtimes.
binding | Host binding to keep a reference to. |
lookupContext | Lookup context. |
sourceRuntime | Source runtime. |
targetRuntime | Target runtime. |
void kanzi::AbstractBindingRuntime::attach | ( | ) |
Attach the binding.
Attaches source and target.
void kanzi::AbstractBindingRuntime::detach | ( | ) |
Detaches the binding.
Detaches all sources and target
void kanzi::AbstractBindingRuntime::detachIfAttachedOrAttaching | ( | ) |
Detaches the binding if it is attaching or attached.
void kanzi::AbstractBindingRuntime::onRemoved | ( | ) |
Called when binding is being removed from where it has been installed.
Automatically called on binding target runtime destruction, but also called manually when binding is being removed from a Node or RenderPass to remove potential installed value sources.
void kanzi::AbstractBindingRuntime::notifySourceChanged | ( | ) |
Called when binding source has changed.
Usually called by binding sources that notify the binding runtime of the change.
void kanzi::AbstractBindingRuntime::notifyTargetChanged | ( | ) |
Called when binding target has changed.
This should not be called for most bindings, as they only work in one direction.
bool kanzi::AbstractBindingRuntime::update | ( | ) |
Execute the binding.
Performs read from the source and write to the target.
|
inline |
Gets the owner.
Set the owner.
owner | Shared pointer to owner. |
|
inline |
Returns the binding associated with this binding runtime.
|
inline |
Indicates whether this binding runtime has been attached.
|
inline |
Indicates whether this binding runtime is being attached.
|
inline |
Indicates whether this binding runtime is detached.
|
inline |
Indicates whether this binding runtime is being detached.
|
inline |
Indicates whether this binding runtime is connected.
Attaching a binding causes it to be potentially connected.
|
inline |
Gets the source runtime.
|
inline |
Gets the target runtime.
void kanzi::AbstractBindingRuntime::setHost | ( | BindingHostConceptSharedPtr | hostObject | ) |
Sets the binding host object in which the binding runtime is hosted.
hostObject | The binding host object in which the binding runtime is hosted. |
void kanzi::AbstractBindingRuntime::removeFromHost | ( | ) |
Removes the binding runtime from the binding host.
When you remove a binding from a host, Kanzi detaches the binding runtime and makes the binding runtime unusable.
bool kanzi::AbstractBindingRuntime::isRemoved | ( | ) | const |
Gets whether the binding runtime has been removed from the binding host.
|
inline |
Gets the lookup context.
Binding-dependent attach.
Lookup context exists when called.
Implemented in kanzi::BindingBaseRuntime, kanzi::BindingRuntime, kanzi::ExpressionBindingRuntime, kanzi::ManualBindingRuntime, kanzi::ToSourceBindingRuntime, and kanzi::TwoWayBindingRuntime.
Binding-dependent detach.
Implemented in kanzi::BindingBaseRuntime, kanzi::ExpressionBindingRuntime, kanzi::ToSourceBindingRuntime, and kanzi::TwoWayBindingRuntime.
Read from source and execute forward validators.
value | Value to read to. |
Reads from target and executes reverse validators.
value | Value to read to. |
Write to target.
value | Value to write. |
Writes to source.
value | Value to write. |
Binding-dependent source change.
Default implementation simply calls update() on the forward direction.
Reimplemented in kanzi::ExpressionBindingRuntime, kanzi::ManualBindingRuntime, and kanzi::ToSourceBindingRuntime.
Binding-dependent target change.
Default implementation of throws an exception.
Reimplemented in kanzi::ToSourceBindingRuntime, and kanzi::TwoWayBindingRuntime.
Binding-dependent update.
Implemented in kanzi::BindingBaseRuntime, kanzi::ExpressionBindingRuntime, kanzi::ManualBindingRuntime, and kanzi::ToSourceBindingRuntime.
Binding-dependent attached indication.
Default implementation checks source and target.
Reimplemented in kanzi::ToSourceBindingRuntime.
|
protected |
Associated binding.
|
protected |
|
protected |
Runtime for source.
|
protected |
Runtime for target.
|
protected |
Current binding runtime state.
A binding runtime may be attached even if it is not connected. Attach is only called once.
|
protected |
Owner for tagging the runtime.
|
protected |
The binding host object in which the binding runtime is hosted.